from PyQt6.QtWidgets import (QApplication, QDialog, QPushButton, QHBoxLayout, QMessageBox)
import sys

def show_msg():
    QMessageBox.information(window, '提示信息', '我被点击了')

if __name__ == "__main__":
    # sys.argv：可以从命令行，传递参数给这个程序，一般用不到
    app = QApplication(sys.argv)
    window = QDialog()
    window.resize(300, 150)

    button = QPushButton("点击")
    button.clicked.connect(show_msg)

    hbox = QHBoxLayout()
    hbox.addWidget(button)

    window.setLayout(hbox)
    window.show()
    sys.exit(app.exec())
